layui.use(['element','form','table'],function(){
    var table = layui.table;
    var form = layui.form;

    table.render({
        elem: '#demo'
        ,toolbar: '#toolbarDemo'
        ,url: '/authUser' //数据接口
        ,page: true //开启分页
        ,cols: [[ //表头
            {field: 'id',title: '人员编号', sort: true, width:120}
            ,{field: 'name', title: '帐号名', width:200}
            ,{field: 'userTrueName',edit: 'text', title: '人员姓名'}
            ,{field: 'roleName', title: '角色',sort: true,}
            ,{fixed: 'right',align:'center', toolbar: '#barDemo',title: '操作',}
        ]]
    });

    //工具栏监听事件--修改
    table.on('tool(test)', function(obj){
        var data = obj.data;
        var layEvent = obj.event;
        var id = obj.data.id;
        if(layEvent === 'edit'){
            window.location.href="userRoleEdit.html?#"+id
        }
    });


});